<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script>
        window.hdjs = {};
        window.hdjs.base = '../';
        window.hdjs.uploader = 'php/uploader.php?';
        window.hdjs.filesLists = 'php/filesLists.php?';
    </script>
    <script src="../dist/static/requirejs/require.js"></script>
    <script src="../dist/static/requirejs/config.js"></script>
</head>
<body style="padding: 50px;">
<div class="input-group">
    <input class="form-control" v-model="v.path">
    <span class="input-group-btn">
        <button class="btn btn-default oss" type="button" id="pickVideo">上传文件</button>
   </span>
</div>
<script>
    require(['oss'], function (oss) {
        var id = '#pickVideo';
        var uploader = oss.upload({
            //获取签名
            serverUrl: 'php/ossSign.php?',
            //上传目录
            dir: 'houdunwang/',
            //按钮元素
            pick: id,
            accept: {
                title: 'Images',
                //extensions: 'mp4',
                //mimeTypes: 'video/mp4'
            }
        });
        //上传开始
        uploader.on('startUpload', function () {
            console.log('开始上传');
        });
        //上传成功
        uploader.on('uploadSuccess', function (file, response) {
            console.log('上传完成,文件名:' + oss.oss.host + '/' + oss.oss.object_name);
        });
        //上传中
        uploader.on('uploadProgress', function (file, percentage) {
            console.log('上传中,进度:' + parseInt(percentage * 100));
        })
        //上传结束
        uploader.on('uploadComplete', function () {
            console.log('上传结束');
        })
    });
</script>
</body>
</html>